package com.example.lean;

import androidx.appcompat.app.AppCompatActivity;

import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    public static  final  String ACTION_SECOND= "com.example.lean.intent.action.SECOND";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void myCallClick(View v) {
        //常用系统uri
        //https://blog.csdn.net/chengkaizone/article/details/20639973
        Uri uri = Uri.parse("tel:10086");//
        Intent intent = new Intent();
        //intent.setAction(Intent.ACTION_VIEW);
        intent.setAction(Intent.ACTION_CALL);
        intent.setData(uri);
        startActivity(intent);
    }
    public void myEmailClick(View v) {
        //常用系统uri
        //https://blog.csdn.net/chengkaizone/article/details/20639973
        Uri uri = Uri.parse("mailto:2806552@qq.com");//
        Intent intent = new Intent();
        intent.setData(uri);
        intent.putExtra(Intent.EXTRA_CC, new String[]{"2806552@qq.com"});
        intent.putExtra(Intent.EXTRA_SUBJECT,"数据主题");
        intent.putExtra(Intent.EXTRA_TEXT,"您好，\n 邮件已收到，谢谢！");
        intent.setData(uri);
        startActivity(intent);
    }
    public void mySmsClick(View v) {
        Uri uri = Uri.parse("sms:13101268816?body=您好！");
        Intent intent = new Intent();
        intent.setData(uri);
        startActivity(intent);
    }
    public void myWebClick(View v) {
        Uri uri = Uri.parse("http://baidu.com");
        Intent intent = new Intent();
        intent.setData(uri);
        startActivity(intent);
    }
    public void myMapClick(View v) {
        Uri uri = Uri.parse("geo:39.896086,116.151147");
        Intent intent = new Intent();
        intent.setData(uri);
        startActivity(intent);
    }
    public void myWebsearchClick(View v) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_WEB_SEARCH);
        intent.putExtra(SearchManager.QUERY,"新浪网");
        startActivity(intent);
    }
}